from PyCmpltrtok.common_opencv import imzoom2fit_rect
import sys
import cv2 as cv
import os

xpath = '/home/asuspei/cuty/pz_art_set/art2022/art2022_04_29Fri/4e4a20a4462309f7338f8cb531b94ef4d5cad6f7@f_webp.jpg'
if len(sys.argv) >= 2:
    xpath = sys.argv[1]
print(xpath)

img = cv.imread(xpath, cv.IMREAD_COLOR)
img_resized = imzoom2fit_rect(img, (2560, 1440))
xdir, xbase = os.path.split(xpath)
xmain, xext = os.path.splitext(xbase)
tgt = f'{xdir}/{xmain}.resized.land.png'
res = cv.imwrite(tgt, img_resized);
print(res, tgt)
